<template>
    <div class="form-group common">
        <label class="col-sm-4 control-label">用户类型：</label>
        <div class="col-sm-8">
            <select class="form-control select2" style="width: 100%;" v-model="selected" @change="$emit('input', $event.target.value)">
                <option value="" disabled selected style='display:none;' v-if="$route.path=='/dangan/add'">请选择</option>
                <option value="" v-if="$route.path=='/tongji/lishi' || $route.path=='/dangan/da-index'">全部</option>
                <option v-for="lst in list" :value="lst.value" :key="lst.value">{{lst.name}}</option>
            </select>

        </div>
    </div>
</template>

<script>

export default {
    props: {
        value: [String, Number],
    },
    data() {
        return {
            list: [],
            selected: this.value
        };
    },
    watch: {
        value() {
            this.selected = this.value;
        }
    },
    mounted() {
        this.getList()
    },
    methods: {
        getList() {
            this.$api.biguser.types().then(res => {
                if (res.success) {
                    // console.log(res.data)
                    this.list=res.data
                }
            });
        },
    }
};
</script>

<style>
</style>
